import http from '@/common/http';
import { Dialog } from 'mand-mobile';
import {
  GET_ROUTE_INFO,
  GET_WAITING_ROUTE_LIST,
  GET_PIN_STATIONS_INFO,
  GET_BAO_STATIONS_INFO,
  IS_OUT_RANGE,
  LOCATION_HAS_BAO_SERVICE,
  GET_ORDER_TIME,
  GET_REMARKS,
  COST_ESTIMAT_CARPOOL,
  COST_ESTIMAT_CHARTER,
  ORDER_SUBMIT,
  GET_ALLOT_INFO,
  GET_ALLOT_INFO_FLAG,
  GET_ALLOT_COST_INFO,
  FENCES_WITHIN_FLAG
} from './actions.types';
import {
  SET_ROUTE_INFO,
  SET_WAITING_ROUE_LIST,
  SET_PIN_STATIONS_INFO,
  SET_BAO_STATIONS_INFO,
  SET_PIN_START_INFO,
  SET_PIN_END_INFO,
  SET_BAO_START_INFO,
  SET_BAO_END_INFO,
  SET_ORDER_TIME,
  PIN_CONFIRM_ORDER_TIME,
  BAO_CONFIRM_ORDER_TIME,
  SET_PIN_PASSENGER_NUMBER,
  SET_BAO_PASSENGER_NUMBER,
  SET_REMARKS,
  SET_PIN_SELECTED_REMARKS,
  SET_BAO_SELECTED_REAMRKS,
  SET_PIN_COST_INFO,
  SET_BAO_COST_INFO,
  SET_USE_HIGHWAY,
  SET_BAO_CAR_TYPE,
  SET_DAIREN_CONTACT,
  DELETE_DAIREN_CONTACT,
  CLEAR_DAIREN_CONTACTS,
  CLEAR_CURRENT_CONTACT,
  SET_ALLOT_INFO,
  SET_ALLOT_COST_INFO,
  SET_FENCES_WITHIN_FLAG
} from './mutations.types';
import Loading from '@/components/loading';
import { decryptByDESModeEBC, encryptByDESModeEBC } from '@/common/encrypt';
var moment = require('moment');
moment.locale('zh-cn');
const defaultState = () => {
  return {
    route: null,
    platformId: '',
    pinStartFences: [],
    pinEndFences: [],
    baoStartFences: [],
    baoEndFences: [],
    pinStartStations: [],
    pinEndStations: [],
    baoStartStations: [],
    baoEndStations: [],
    waitingRouteList: [],
    remarks: [],
    pinStartInfo: null,
    pinEndInfo: null,
    baoStartInfo: null,
    baoEndInfo: null,
    pinStartWaitingTime: null,
    baoStartWaitingTIme: null,
    orderTime: [],
    pinConfirmOrderTime: null,
    baoConfirmOrderTime: null,
    pinNumPassenger: 0,
    baoNumPassenger: 0,
    pinSelectedRemarks: [],
    baoSelectedRemarks: [],
    pinCostInfo: null,
    baoCostInfo: null,
    allotCostInfo: null,
    useHighway: {
      text: '不走高速',
      value: '0'
    },
    baoCarType: '',
    dairenContacts: [],
    selectedContact: null,
    allotInfo: null,
    orderTimeMsg: null
  };
};
const defaultPin = () => {
  return {
    pinStartInfo: null,
    pinEndInfo: null,
    pinStartWaitingTime: null,
    pinConfirmOrderTime: null,
    pinNumPassenger: 0,
    pinSelectedRemarks: [],
    pinCostInfo: null,
    orderTime: []
  };
};
const defaultBao = () => {
  return {
    baoStartInfo: null,
    baoEndInfo: null,
    baoStartWaitingTIme: null,
    baoConfirmOrderTime: null,
    baoNumPassenger: 0,
    baoSelectedRemarks: [],
    baoCostInfo: null,
    useHighway: {
      text: '不走高速',
      value: '0'
    },
    baoCarType: ''
  };
};
const state = defaultState();

function fixCoord(arr) {
  if (!arr) {
    return;
  }
  arr.forEach(item => {
    if (typeof item.coordinate === 'string') {
      item.coordinate = item.coordinate.split(','); // 做一次数组转换，方便直接给高德地图使用
    }
  });
  return arr;
}

function fixFences(str) {
  let arr = [];
  let fences = str.split(';');
  fences.forEach(item => {
    let coord = item.split(',');
    arr.push(coord);
  });
  return arr;
}

function fixCenterPort(point) {
  let port = null;
  if (point !== '') {
    port = point.split(',');
  }
  return port;
}
const getters = {
  getRoute(state) {
    // 当前线路所有信息
    return state.route;
  },
  getWaitingRoute(state) {
    // 当前线路待出发行程
    if (state.waitingRouteList) {
      return state.waitingRouteList.list;
    }
    return null;
  },
  pinStartStations(state) {
    // 拼车起点上车点
    return fixCoord(state.pinStartStations);
  },
  pinEndStations(state) {
    // 拼车终点下车点
    return fixCoord(state.pinEndStations);
  },
  baoStartStations(state) {
    // 包车起点上车点
    return fixCoord(state.baoStartStations);
  },
  baoEndStations(state) {
    // 包车终点下车点
    return fixCoord(state.baoEndStations);
  },
  pinStartFences(state) {
    // 拼车起点围栏
    return fixFences(state.route.start_electric_fence);
  },
  pinEndFences(state) {
    // 拼车终点围栏
    return fixFences(state.route.end_electric_fence);
  },
  baoStartFences(state) {
    // 包车起点围栏
    return fixFences(state.route.start_electricfence);
  },
  baoEndFences(state) {
    // 包车终点围栏
    return fixFences(state.route.end_electricfence);
  },
  pinStartMapCenter(state) {
    // 拼车起点中心点
    return fixCenterPort(state.route.start_electric_fencePort);
  },
  pinEndMapCenter(state) {
    // 拼车终点中心点
    return fixCenterPort(state.route.end_electric_fencePort);
  },
  baoStartMapCenter(state) {
    // 包车起点中心点
    return fixCenterPort(state.route.start_electricfencePort);
  },
  baoEndMapCenter(state) {
    // 包车终点中心点
    return fixCenterPort(state.route.end_electricfencePort);
  },
  getPinStartInfo(state) {
    return state.pinStartInfo;
  },
  getPinEndInfo(state) {
    return state.pinEndInfo;
  },
  getBaoStartInfo(state) {
    return state.baoStartInfo;
  },
  getBaoEndInfo(state) {
    return state.baoEndInfo;
  },
  getPinStartTimeConfig(state) {
    let result = {};
    result.start = state.route.start_lstime_start;
    result.end = state.route.start_lstime_end;
    result.span = state.route.order_time_span_start;
    result.preTime = state.route.car_pin_time_start; // 提前下单时间
    result.type = state.route.pin_time_type_start;
    return result;
  },
  getBaoStartTimeConfig(state) {
    let result = {};
    result.start = state.route.start_bao_lstime_start;
    result.end = state.route.start_bao_lstime_end;
    result.span = 30; // 下单时间间隔
    result.preTime = state.route.car_bao_time_start; // 提前下单时间
    return result;
  },
  getOrderTime(state) {
    return [state.orderTime]; // 需要多嵌套一个数组
  },
  getWaitingOrderTime(state) {
    // let count = parseInt(state.route.order_time_span_start) / 30;
    // let arr = [];
    // for (let i = 0; i < count; i++) {
    // 	let num = i * 30 + 30;
    // 	let obj = {
    // 		text: num + '分钟',
    // 		value: num
    // 	};
    // 	arr.push(obj);
    // }
    if (state.route.order_wait_time) {
      let count = state.route.order_wait_time.split(',');
      let arr = [];
      for (let i = 0; i < count.length; i++) {
        let num = count[i];
        let obj = {
          text: num + '分钟',
          value: num
        };
        arr.push(obj);
      }
      return [arr];
    }
  },
  getPinConfirmStartTime(state) {
    return state.pinConfirmOrderTime;
  },
  getPinStartTimeString(state) {
    let str = '';
    if (state.pinConfirmOrderTime) {
      // return state.pinConfirmOrderTime.timeStr + "  等待" + state.pinConfirmOrderTime.wait + '分钟';
      if (state.pinConfirmOrderTime.wait > 0) {
        str =
          state.pinConfirmOrderTime.timeStr +
          '  等待' +
          state.pinConfirmOrderTime.wait +
          '分钟';
      } else {
        str = state.pinConfirmOrderTime.timeStr;
      }
    }
    return str;
  },
  getBaoStartTime(state) {
    return state.baoConfirmOrderTime;
  },
  getRemarks(state) {
    return state.remarks;
  },
  hasShangwu(state) {
    let has = false;
    if (state.route.shangwuFlag === '1') {
      has = true;
    }
    return has;
  },
  pinNumPassenger(state) {
    return state.pinNumPassenger;
  },
  baoNumPassenger(state) {
    return state.baoNumPassenger;
  },
  getRemarks(state) {
    return state.remarks;
  },
  getPinSelectedRemarks(state) {
    return state.pinSelectedRemarks;
  },
  getPinSelectedRemarksString(state) {
    let str = '';
    let arr = [];
    if (state.pinSelectedRemarks) {
      if (state.pinSelectedRemarks.length > 0) {
        state.pinSelectedRemarks.forEach(item => {
          arr.push(item);
        });
        str = arr.join(',');
      } else {
        str = '无';
      }
    }
    return str;
  },
  getBaoSelectedRemarks(state) {
    return state.baoSelectedRemarks;
  },
  getBaoSelectedRemarksString(state) {
    let str = '';
    let arr = [];
    if (state.baoSelectedRemarks) {
      if (state.baoSelectedRemarks.length > 0) {
        state.baoSelectedRemarks.forEach(item => {
          arr.push(item);
        });
        str = arr.join(',');
      } else {
        str = '无';
      }
    }
    return str;
  },
  getPinCostInfo(state) {
    return state.pinCostInfo;
  },
  getBaoCostInfo(state) {
    return state.baoCostInfo;
  },
  getUseHighway(state) {
    return state.useHighway;
  },
  getBaoCarType(state) {
    let str = '公务车';
    if (state.baoCarType !== '') {
      str = state.baoCarType;
    }
    return str;
  },
  getDairenContacts(state) {
    if (state.dairenContacts.length <= 0) {
      let str = localStorage.getItem('historyContacts');
      if (str) {
        state.dairenContacts = JSON.parse(str);
      }
    }
    return state.dairenContacts;
  },
  getSelectedContact(state) {
    return state.selectedContact;
  },
  getPinAdv(state) {
    if (state.route) {
      let adv = {
        url: state.route.pin_car_adv,
        img: state.route.pin_car_adv_img
      };
      return adv;
    } else {
      return null;
    }
  },
  getBaoAdv(state) {
    if (state.route) {
      let adv = {
        url: state.route.bao_car_adv,
        img: state.route.bao_car_adv_img
      };
      return adv;
    } else {
      return null;
    }
  },
  getDaiAdv(state) {
    if (state.route) {
      let adv = {
        url: state.route.dai_car_adv,
        img: state.route.dai_car_adv_img
      };
      return adv;
    } else {
      return null;
    }
  },
  getAllotInfo(state) {
    return state.allotInfo;
  },
  getAllotCostInfo(state) {
    return state.allotCostInfo;
  },
  getOrderTimeMsg(state) {
    return state.orderTimeMsg;
  }
};
const actions = {
  [GET_ROUTE_INFO](context, routeId) {
    Loading.show();
    return new Promise((resolve, reject) => {
      http
        .post('pakj/route/getRouteById', {
          route_id: routeId
        })
        .then(res => {
          Loading.hide();
          if (res.data.code === '000000') {
            context.commit(SET_ROUTE_INFO, res.data.data);
            if (res.data.data.open_flag === '1') {
              resolve();
            } else {
              let obj = {
                msg: res.data.data.open_flag_msg,
                url: res.data.data.open_flag_url
              };
              resolve(obj);
            }
          } else {
            Dialog.alert({
              title: '错误',
              content: res.data.msg,
              confirmText: '确定'
            });
            reject(new Error(res.data.code + ':' + res.data.msg));
          }
        });
    });
  },
  [GET_WAITING_ROUTE_LIST](context, date = '') {
    return new Promise((resolve, reject) => {
      if (date === '') {
        date = moment().format('YYYY-MM-DD');
      }
      let params = {
        route_id: context.getters.getRoute.route_id,
        page: 0,
        rows: 20,
        travel_time: date
      };
      Loading.show();
      http.post('pakj/order/getWaitAllotByRoute', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          context.commit(SET_WAITING_ROUE_LIST, res.data.data);
          resolve();
        } else {
          Dialog.alert({
            title: '错误',
            content: res.data.msg,
            confirmText: '确定'
          });
          reject(new Error(res.data.code + ':' + res.data.msg));
        }
      });
    });
  },
  [GET_PIN_STATIONS_INFO](context) {
    return new Promise((resolve, reject) => {
      let params = {
        route_id: context.getters.getRoute.route_id,
        type: '1'
      };
      Loading.show();
      http.post('pakj/route/routeStationList', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          context.commit(SET_PIN_STATIONS_INFO, res.data.data);
          resolve();
        } else {
          Dialog.alert({
            title: '错误',
            content: res.data.msg,
            confirmText: '确定'
          });
          reject(new Error(res.data.code + ':' + res.data.msg));
        }
      });
    });
  },
  [GET_BAO_STATIONS_INFO](context) {
    return new Promise((resolve, reject) => {
      let params = {
        route_id: context.getters.getRoute.route_id,
        type: '2'
      };
      Loading.show();
      http.post('pakj/route/routeStationList', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          context.commit(SET_BAO_STATIONS_INFO, res.data.data);
          resolve();
        } else {
          Dialog.alert({
            title: '错误',
            content: res.data.msg,
            confirmText: '确定'
          });
          reject(new Error(res.data.code + ':' + res.data.msg));
        }
      });
    });
  },
  [IS_OUT_RANGE](context, params) {
    return new Promise((resolve, reject) => {
      Loading.show();
      let url = '';
      if (params.type === '1') {
        // 拼车
        url = 'pakj/order/isFenceWithinCarpool';
      } else {
        url = 'pakj/order/isFenceWithinCharter';
      }
      http.post(url, params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          resolve();
        } else {
          reject(new Error(res.data.msg));
        }
      });
    });
  },
  [LOCATION_HAS_BAO_SERVICE](context, params) {
    return new Promise((resolve, reject) => {
      Loading.show();
      http.post('/pakj/order/isFenceWithin', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          resolve(res.data.data);
        } else {
          reject(new Error(res.data.msg));
        }
      });
    });
  },
  [GET_ORDER_TIME](context, orderType) {
    return new Promise((resolve, reject) => {
      Loading.show();
      let params = {
        route_id: context.getters.getRoute.route_id,
        order_type: orderType
      };
      http.post('pakj/route/getNewOrderTime', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          console.log(res.data.data);
          let data = res.data.data.orderTime;
          if (data.length > 0) {
            data.forEach((item, index) => {
              let mom = moment(item.value, 'x');
              item.text = mom.calendar(null, {
                sameDay: 'MMMDo[今天]',
                nextDay: 'MMMDo[明天]',
                nextWeek: 'MMMDodddd',
                lastDay: 'MMMDo[昨天]',
                lastWeek: 'MMMDodddd',
                sameElse: 'MMMDodddd'
              });
              item.children.forEach((item, index) => {
                if (item.car_flag === '1') {
                  item.text += ' 有车';
                }
              });
            });
          }
          context.commit(SET_ORDER_TIME, data);
          context.commit('setOrderTimeMsg', res.data.data.orderTimeText);
          resolve();
        } else {
          Dialog.alert({
            title: '错误',
            content: res.data.msg,
            confirmText: '确定'
          });
          reject(new Error(res.data.code + ':' + res.data.msg));
        }
      });
    });
  },
  [GET_REMARKS](context, type) {
    return new Promise((resolve, reject) => {
      Loading.show();
      let params = {
        order_type: type
      };
      http.post('pakj/order/remarkTempList', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          context.commit(SET_REMARKS, res.data.data);
          resolve();
        } else {
          Dialog.alert({
            title: '错误',
            content: res.data.msg,
            confirmText: '确定'
          });
          reject(new Error(res.data.code + ':' + res.data.msg));
        }
      });
    });
  },
  [COST_ESTIMAT_CARPOOL](context, params) {
    // 拼车价格评估
    return new Promise((resolve, reject) => {
      Loading.show();
      http.post('pakj/order/costEstimatCarpool', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          context.commit(SET_PIN_COST_INFO, res.data.data);
          resolve();
        } else {
          Dialog.alert({
            title: '错误',
            content: res.data.msg,
            confirmText: '确定'
          });
          reject(new Error(res.data.code + ':' + res.data.msg));
        }
      });
    });
  },
  [COST_ESTIMAT_CHARTER](context, params) {
    // 包车价格评估
    return new Promise((resolve, reject) => {
      Loading.show();
      http.post('pakj/order/costEstimatCharter', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          context.commit(SET_BAO_COST_INFO, res.data.data);
          resolve();
        } else {
          Dialog.alert({
            title: '错误',
            content: res.data.msg,
            confirmText: '确定'
          });
          reject(new Error(res.data.code + ':' + res.data.msg));
        }
      });
    });
  },
  [ORDER_SUBMIT](context, params) {
    return new Promise((resolve, reject) => {
      Loading.show();
      http.post('pakj/order/generateOrder', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          context.commit('setOrderInfo', res.data.data);
          resolve();
        } else {
          reject(new Error(res.data.msg));
        }
      });
    });
  },
  [GET_ALLOT_INFO](context, allotid) {
    return new Promise((resolve, reject) => {
      Loading.show();
      http
        .post('pakj/order/getWaitAllotDetailByRouteId', {
          allot_id: allotid
        })
        .then(res => {
          Loading.hide();
          if (res.data.code === '000000') {
            context.commit(SET_ALLOT_INFO, res.data.data);
            resolve();
          } else {
            reject(new Error(res.data.msg));
          }
        });
    });
  },
  [GET_ALLOT_INFO_FLAG](context, allotid) {
    return new Promise((resolve, reject) => {
      Loading.show();
      http
        .post('pakj/order/getWaitAllotDetailByRouteId', {
          allot_id: allotid,
          flag: '1'
        })
        .then(res => {
          Loading.hide();
          if (res.data.code === '000000') {
            context.commit(SET_ALLOT_INFO, res.data.data);
            resolve();
          } else {
            reject(new Error(res.data.msg));
          }
        });
    });
  },
  [GET_ALLOT_COST_INFO](context, params) {
    return new Promise((resolve, reject) => {
      Loading.show();
      http.post('pakj/order/costEstimatWaitAllot', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          context.commit(SET_ALLOT_COST_INFO, res.data.data);
          resolve();
        } else {
          Dialog.alert({
            title: '错误',
            content: res.data.msg,
            confirmText: '确定'
          });
          reject(new Error(res.data.code + ':' + res.data.msg));
        }
      });
    });
  },
  [FENCES_WITHIN_FLAG](context, params) {
    return new Promise((resolve, reject) => {
      Loading.show();
      http.post('/pakj/order/isFenceWithinflag', params).then(res => {
        Loading.hide();
        if (res.data.code === '000000') {
          context.commit(SET_FENCES_WITHIN_FLAG, res.data.data);
          resolve();
        } else {
          Dialog.alert({
            title: '错误',
            content: res.data.msg,
            confirmText: '确定'
          });
          reject(new Error(res.data.code + ':' + res.data.msg));
        }
      });
    });
  },
  getAdsorptionSiteByLnglat(context, params) {
    return new Promise((resolve, reject) => {
      http.post('/pakj/route/getAdsorptionSiteByLnglat', params).then(res => {
        if (res.data.code === '000000') {
          resolve(res.data.data);
        } else {
          reject(new Error(res.data.msg));
        }
      });
    });
  }
};
const mutations = {
  resetRoute(state) {
    console.log('-----------线路信息重置-----------');
    Object.assign(state, defaultState());
  },
  resetPin(state) {
    Object.assign(state, defaultPin());
  },
  resetBao(state) {
    Object.assign(state, defaultBao());
  },
  exchangeBaoStartEndInfo(state) {
    let oldStartInfo = JSON.parse(JSON.stringify(state.baoStartInfo));
    let oldEndInfo = JSON.parse(JSON.stringify(state.baoEndInfo));
    state.baoStartInfo = oldEndInfo;
    state.baoEndInfo = oldStartInfo;
  },
  [SET_ROUTE_INFO](state, data) {
    state.route = data;
    console.log('当前线路信息：', data);
  },
  [SET_WAITING_ROUE_LIST](state, data) {
    state.waitingRouteList = data;
  },
  [SET_PIN_STATIONS_INFO](state, data) {
    // 拼车站点信息
    state.pinStartStations = data.route_start;
    state.pinEndStations = data.route_end;
  },
  [SET_BAO_STATIONS_INFO](state, data) {
    // 包车站点信息
    state.baoStartStations = data.route_start;
    state.baoEndStations = data.route_end;
  },
  [SET_PIN_START_INFO](state, data) {
    state.pinStartInfo = data;
  },
  [SET_PIN_END_INFO](state, data) {
    state.pinEndInfo = data;
  },
  [SET_BAO_START_INFO](state, data) {
    state.baoStartInfo = data;
  },
  [SET_BAO_END_INFO](state, data) {
    state.baoEndInfo = data;
  },
  [SET_ORDER_TIME](state, data) {
    state.orderTime = data;
  },
  clearOrderTime(state, data) {
    state.orderTime = [];
  },
  [PIN_CONFIRM_ORDER_TIME](state, data) {
    state.pinConfirmOrderTime = data;
  },
  [BAO_CONFIRM_ORDER_TIME](state, data) {
    state.baoConfirmOrderTime = data;
  },
  [SET_PIN_PASSENGER_NUMBER](state, value) {
    state.pinNumPassenger = value;
  },
  [SET_BAO_PASSENGER_NUMBER](state, value) {
    state.baoNumPassenger = value;
  },
  [SET_REMARKS](state, data) {
    state.remarks = data;
  },
  [SET_PIN_SELECTED_REMARKS](state, value) {
    state.pinSelectedRemarks = value;
  },
  [SET_BAO_SELECTED_REAMRKS](state, value) {
    state.baoSelectedRemarks = value;
  },
  [SET_PIN_COST_INFO](state, data) {
    console.log(data);
    state.pinCostInfo = data;
  },
  [SET_BAO_COST_INFO](state, data) {
    state.baoCostInfo = data;
  },
  [SET_USE_HIGHWAY](state, flag) {
    state.useHighway = flag;
  },
  [SET_BAO_CAR_TYPE](state, type) {
    state.baoCarType = type;
  },
  [SET_DAIREN_CONTACT](state, contact) {
    state.selectedContact = contact;
    if (state.dairenContacts.indexOf(contact) >= 0) {
      return;
    }
    if (state.dairenContacts) {
      state.dairenContacts.push(contact);
    }
    let str = JSON.stringify(state.dairenContacts);
    localStorage.setItem('historyContacts', str);
  },
  [DELETE_DAIREN_CONTACT](state, contact) {
    if (state.dairenContacts) {
      if (state.dairenContacts.indexOf(contact) !== -1) {
        state.dairenContacts.splice(state.dairenContacts.indexOf(contact), 1);
      }
    }
    let str = JSON.stringify(state.dairenContacts);
    localStorage.setItem('historyContacts', str);
  },
  [CLEAR_DAIREN_CONTACTS](state) {
    if (state.dairenContacts) {
      state.dairenContacts = [];
    }
    localStorage.removeItem('historyContacts');
  },
  [CLEAR_CURRENT_CONTACT](state) {
    state.selectedContact = null;
  },
  [SET_ALLOT_INFO](state, data) {
    state.allotInfo = data;
  },
  [SET_ALLOT_COST_INFO](state, data) {
    state.allotCostInfo = data;
  },
  setOrderTimeMsg(state, data) {
    console.log('拼车时间提示：', data);
    state.orderTimeMsg = data;
  }
};
export default {
  state,
  getters,
  actions,
  mutations
};
